home *** CD-ROM | disk | FTP | other *** search
/ Joystick Magazine 1996 May / cd joy 71No13.iso / pc / demos / eurosoc / source / euro_fxd.asm < prev    next >
Assembly Source File  |  1996-03-07  |  826b  |  61 lines

  1.         .model large
  2.         .486
  3.  
  4. ;        .386
  5. ;
  6. ;        SMART   ;Optimise all code
  7. ;
  8. ;        LOCALS  ;allow local symbols
  9. ;
  10. ;        WARN
  11. ;
  12. ;_data      segment para public use16 'data'
  13. ;
  14. ;_data    ends
  15. ;
  16. ;
  17. ;    assume  cs:a_code,ds:_data
  18. ;
  19. ; Parameters passed as follows:
  20. ; 1st in EAX
  21. ; 2nd in EDX
  22. ; 3rd in EBX
  23. ; 4th in ECX
  24. ;
  25. a_code    segment word public use32 'code'
  26.  
  27.     public    mul_64bit_
  28. mul_64bit_    proc near
  29.  
  30.     imul    edx    ;edx:eax = edx*eax
  31.     shl    edx,20
  32.     shr    eax,12
  33.     or    eax,edx
  34.     ret
  35.  
  36. mul_64bit_        endp
  37.  
  38.  
  39. ; pass (f0,0,f1) for f0/f1
  40.     public    div_64bit_
  41. div_64bit_    proc near
  42.     idiv    ebx        ;result in eax
  43.     mov    ecx,eax
  44.     ; fraction = (remainder*4096)/f1
  45.     shl    edx,12        ;times 4096
  46.     mov    eax,edx
  47.     xor    edx,edx
  48.     idiv    ebx
  49.     and    eax,4095
  50.     shl    ecx,12
  51.     or    eax,ecx
  52.     ret
  53. div_64bit_    endp
  54.     
  55.  
  56. a_code    ends
  57.  
  58.  
  59.     end
  60. 
  61.